import request from '@/utils/request'
export const urlPrefix = '/oms/hawkeye/job/'

// 查询任务列表
export function listHawkeyeJob(query) {
    return request({
        url: urlPrefix,
        method: 'get',
        params: query
    })
}

// 查询任务详细
export function getHawkeyeJob(id) {
    return request({
        url: urlPrefix + `${id}/`,
        method: 'get',
    })
}

// 新增定时任务
export function addHawkeyeJob(data) {
    return request({
        url: urlPrefix,
        method: 'post',
        data: data
    })
}

// 删除定时任务
export function delHawkeyeJob(id) {
    return request({
        url: urlPrefix + `${id}/`,
        method: 'delete'
    })
}

// 修改定时任务
export function updateHawkeyeJob(data) {
    return request({
        url: urlPrefix + `${data.id}/`,
        method: 'put',
        data: data,
    })
}

// 用户状态修改
export function changeHawkeyeJobStatus(data) {
    return request({
        url: urlPrefix + `${data.id}/change_status/`,
        method: "put",
        data: data,
    });
}

// 启动定时任务
export function startHawkeyeJob(data) {
    return request({
        url: urlPrefix + 'start/',
        method: 'put',
        data: data
    })
}

// 停止定时任务
export function stopHawkeyeJob(data) {
    return request({
        url: urlPrefix + '/stop/',
        method: 'put',
        data: data
    })
}

// 停止所有定时任务
export function stopHawkeyeJobAll(data) {
    return request({
        url: urlPrefix + 'stop_all/',
        method: 'put',
        data: data
    })
}